import {BASEURL} from "./consts.js"


function request({url,method = "GET",data} = {}) {
	return new Promise((resolve, rejext) => {
		uni.showLoading({
			title: "加载中"
		})
		uni.request({
			url: BASEURL + url,
			method,
			data,
			success: (res) => {
				resolve(res.data)
			},
			fail() {
				uni.showToast({
					title: '网络错误'
				});
			},
			complete() {
				uni.hideLoading()
			}
		})
	})

}
export default request
